package com.example.demo.model.index.index.contoller;

import com.example.demo.Results.ResultClass;
import com.example.demo.model.goods.goods.entity.ShopGoods;
import com.example.demo.model.index.index.entity.ShopCartReq;
import com.example.demo.model.index.index.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
@RequestMapping("/index/index")
public class IndexResource {
    @Autowired
    IndexService indexService;

    @GetMapping("/index")
    public ModelAndView index() {
        return indexService.index();
    }
    @GetMapping("/shopCart")
    public ModelAndView shopCart(Integer addressId) {
        return indexService.shopCart(addressId);
    }

    @PostMapping("/shopCartGet")
    public ResultClass shopCartGet(@RequestBody List<ShopCartReq> jsonStr) {
        return indexService.shopCartGet(jsonStr);
    }

}
